#pragma once
//#include "RobotInstance.h"

namespace RobotPlant { namespace RobotProxy{
	using namespace std;
	using namespace boost::join;
	using namespace RobotPlant::Common;

	class RobotInstance;

	enum DeviceTypeEnum
	{
		Unknow = 0,
		DeviceDictionary = 1,
		AnalogSensor = 2,
		Arm = 3,
		Battery = 4,
		Camera = 5,
		ContactSensor = 6,
		DiffDrive = 7,
		Encoder = 8,
		Motor = 9,
		SickLRF = 10,
		Sonar = 11,
		Stream = 12,
	};

	/*
	Represents a frame transformation in 3D space (rotation + translation)
	*/
	class RP_ROBOTPROXY_API DeviceBase: public joint
	{
	protected:
		RobotInstance* _pParent;
		/*
		The device type.
		*/
		DeviceTypeEnum _deviceType;

		/*
		The device index.
		*/
		int _deviceIndex;

	public:
		/*
		Constructor
		*/
		DeviceBase(RobotInstance* pParent,joint::spawn_type e=0);

		/*
		Destructor
		*/
		~DeviceBase();

		/*
		Get the device type.
		*/
		DeviceTypeEnum GetDeviceType();

		/*
		Get the device index.
		*/
		int GetDeviceIndex();

		/*
		The device hardware id.
		There is error if return value < 0.
		*/
		synch<int,void> HardwareID;

		/*
		The device name.
		There is error if return null string.
		*/
		synch<std::string,void> Name;

		/*
		The device pose w.r.t robot base frame.
		There is error if return pose with 0 element.
		*/
		synch<std::vector<double>,void> Pose;

	protected:
		int Handler_GetHardwareID(void_t);

		std::string Handler_GetName(void_t);

		std::vector<double> Handler_GetPose(void_t);
	};
}}
